package com.gxuwz.library_consumer.service;

import com.github.pagehelper.PageInfo;
import com.gxuwz.commonmodule.entity.Book;
import com.gxuwz.commonmodule.entity.BorrowRecord;
import com.gxuwz.commonmodule.entity.User;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.*;

import java.util.List;
@Component
@FeignClient(value = "library-provider")
public interface BookService {
    /**
     * 查询所有图书信息
     * @param book
     * @return
     */
    @GetMapping(value = "/list")
    public List<Book> list(@RequestBody Book book);

    /**
     * 添加图书信息
     * @param book
     */
    @PostMapping( "/add")
    public void save(@RequestBody Book book);

    /**
     * 通过ID删除图书信息
     * @param bookID
     */
    @DeleteMapping("/delete/{bookID}")
    public void deleteBook (@PathVariable("bookID")String bookID);

    /**
     * 通过ID 查询图书信息
     * @param bookID
     * @return
     */
    @GetMapping("/get/{bookID}")
    public Book findById(@PathVariable("bookID")String bookID);

    /**
     * 更新图书信息
     * @param book
     */
    @PutMapping("/update")
    public void updateBook(@RequestBody Book book);

    /**
     * 分页查询图书信息
     * @param pageIndex
     * @param pageSize
     * @return
     */
    @GetMapping("/findPage")
    PageInfo findPage(@RequestParam(value = "pageIndex") int pageIndex,@RequestParam(value = "pageSize") int pageSize);
}
